﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LeagueOfRila.View;
using LeagueOfRila.Model;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace LeagueOfRila.Controller
{
    public abstract class BaseController
    {
        public BaseView view;
        public BaseModel model;
        abstract public string viewName { get; set; }
        abstract public string modelName { get; set; }

        public BaseController()
        {
            this.view = System.Reflection.Assembly.GetExecutingAssembly().CreateInstance(viewName) as BaseView;
            this.model = System.Reflection.Assembly.GetExecutingAssembly().CreateInstance(modelName) as BaseModel;
            this.model.controller = this;
            this.view.model = this.model;
            this.view.controller = this;
            this.model.view = this.view;
          
            
        }
        public void Run()
        {
            this.view.Run();
        }
        public virtual void Update(GameTime gameTime)
        {
            if (Keyboard.GetState().IsKeyDown(Keys.Escape))
                this.view.Exit();
        }
        
    }


}
